<!DOCTYPE html>
<html lang="ru">
{% load static %}
{% load ann_notifications %}

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="icon" href="{% static 'img/global/icon.png' %}">
    <link rel="preconnect" href="https://fonts.googleapis.com">
    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
    <link href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;700&display=swap" rel="stylesheet">
    {% if user.is_authenticated %}
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.0/jquery.min.js"></script>
    <link rel="stylesheet" href="{% static 'css/global/header.css' %}?v=3">
    <link rel="stylesheet" href="{% static 'css/global/footer.css' %}?v=1">
    <link rel="stylesheet" href="{% static 'css/global/index.css' %}?v=3">
    {% block head %}
    {% endblock head %}
    {% else %}
    <link rel="stylesheet" href="{% static 'css/global/not_authorized.css' %}">
    <title>Who?</title>
    {% endif %}
</head>

<body>
    {% if user.is_authenticated %}
    <header class="header">
        <a href="{% url 'home' %}" class="logo"><img src="{% static 'img/global/icon.png' %}" alt="Логотип сайта"></a>
        <nav class="nav">
            <ul class="nav-list">
                <li class="nav-item">
                    <a href="{% url 'theme_list' %}">Список тем</a>
                </li>
                <li class="nav-item">
                    <a href="{% url 'projects' %}">Управление проектом</a>
                </li>
                <li class="nav-item">
                    <a href="{% url 'archive' %}">Архив работ</a>
                </li>
            </ul>
        </nav>
        <div class="notifications">
            {% unread_notification_count request.user as notifications_ann %}
            <button class="notifications-btn" onclick="notification(this)">
                <svg class="notifications-svg" viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg" ><path d="M440.08,341.31c-1.66-2-3.29-4-4.89-5.93-22-26.61-35.31-42.67-35.31-118,0-39-9.33-71-27.72-95-13.56-17.73-31.89-31.18-56.05-41.12a3,3,0,0,1-.82-.67C306.6,51.49,282.82,32,256,32s-50.59,19.49-59.28,48.56a3.13,3.13,0,0,1-.81.65c-56.38,23.21-83.78,67.74-83.78,136.14,0,75.36-13.29,91.42-35.31,118-1.6,1.93-3.23,3.89-4.89,5.93a35.16,35.16,0,0,0-4.65,37.62c6.17,13,19.32,21.07,34.33,21.07H410.5c14.94,0,28-8.06,34.19-21A35.17,35.17,0,0,0,440.08,341.31Z"/><path d="M256,480a80.06,80.06,0,0,0,70.44-42.13,4,4,0,0,0-3.54-5.87H189.12a4,4,0,0,0-3.55,5.87A80.06,80.06,0,0,0,256,480Z"/></svg>
                {% if notifications_ann.count %}
                    <div class="notifications-div"></div>
                {% endif %}
            </button>
            <div class="notifications-content">
                <h2 class="notifications-title">Уведомления</h2>
                {% if notifications_ann.count %}
                    <ul class="notifications-list">
                        {% for announcement in notifications_ann.announcements %}
                            <li class="notifications-item">
                                <h3 class="notifications-subtitle">{{ announcement.title }}</h3>
                                <a class="notifications-link" href="/announcements/">Перейти на страницу →</a>
                            </li>
                        {% endfor %}
                    </ul>
                {% else %}
                    <div class="notifications-non">
                        <span class="notifications-span">У вас нет непрочитанных уведомлений</span>
                    </div>
                                
                {% endif %}

            </div>
        </div>
        <div class="user">
            <button class="user-avatar" onclick="user(this)">
                <img class="avatar" src="{{ user.avatar.url }}" alt="Аватарка пользователя">
                <div class="user-arrow-down"></div>
            </button>
            <div class="user-content">
                <a class="user-info" href="{% url 'profile' %}">
                    <img class="avatar" src="{{ user.avatar.url }}" alt="Аватарка пользователя">
                    <div class="user-naming">
                        <h2 class="user-fio">{{user.getPName}}</h2>
                        <p class="user-username logedin">{{user.username}}</p>
                        <div class="user-arrow">
                            <svg height="512px" id="Layer_1" style="enable-background:new 0 0 512 512;" version="1.1" viewBox="0 0 512 512" width="512px" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" fill="rgb(31 63 118 / 51%)"><polygon points="160,115.4 180.7,96 352,256 180.7,416 160,396.7 310.5,256 "/></svg>
                        </div>
                    </div>
                </a>
                <ul class="user-links-list">
                    <li class="user-links-item">
                        <a href="{% url 'announcements' %}" class="user-link attention-icon">Объявления</a>
                    </li>
                    <li class="user-links-item">
                        <a href="{% url 'home' %}#contests" class="user-link contests-icon">Конкурсы</a>
                    </li>
                    {% if user.is_superuser %}
                    <li class="user-links-item">
                        <a href="{% url 'admin_menu' %}" class="user-link">Администрирование</a>
                    </li>
                    {% endif %}
                </ul>
                <form action="{% url 'logout' %}" method="post">
                    {% csrf_token %}
                    <button class="user-button" type="submit">Выйти из профиля</button>
                </form>
            </div>
        </div>
    </header>
    <main class="main">
        {% block content%}
        {% endblock content %}
    </main>


    <footer class="footer">
        <div class="container">
            <div class="footer-top">
                <a href="{% url 'home' %}" class="long-logo"><img src="{% static 'img/global/long_logo_white.svg' %}"
                        alt="Логотип лицея"></a>
                <address class="footer-contact">
                    <p class="footer-title">Контакты</p>
                    <div>
                        <ul class="footer-contact-list">
                            <li class="footer-contact-item">
                                <a href="https://yandex.ru/maps/org/maou_litsey_38/1018549864/?indoorLevel=1&ll=44.015949%2C56.315411&z=17.09" target="_blank">Нижний Новгород, ул. Ванеева, 7/57</a>
                            </li>
                            <li class="footer-contact-item">
                                <a href="mailto:l38_nn@mail.52gov.ru">l38_nn@mail.52gov.ru</a>
                            </li>
                            <li class="footer-contact-item">
                                <a href="tel:+78314288306">+ 7(831) 428-83-06</a>
                            </li>
                        </ul>
                    </div>
                </address>
                <div class="useful-links">
                    <p class="footer-title">Полезные ссылки</p>
                    <div class="footer-useful-links">
                        <a class="lic-link" href="https://ntl38.ru" target="_blank">Официальный сайт лицея</a>
                        <a class="lic-link" href="https://t.me/+F-Ck6-C7jPEwYzAy" target="_blank">Сообщить об ошибке</a>
                    </div>
                </div>
                <div class="footer-links">
                    <p class="footer-title">Мы в соц. сетях</p>
                    <a href="https://vk.com/lycee38ntl">
                        <svg width="25" height="25" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
                            <g clip-path="url(#clip0_427_18)">
                                <path
                                    d="M19.2152 4.49854H15.9698C15.8373 4.49854 15.7073 4.53445 15.5936 4.60246C15.4799 4.67047 15.3868 4.76802 15.3242 4.88475C15.3242 4.88475 14.0298 7.26862 13.6139 8.0716C12.4954 10.2315 11.771 9.55344 11.771 8.55096V5.09445C11.771 4.80561 11.6563 4.5286 11.4521 4.32436C11.2478 4.12012 10.9708 4.00538 10.682 4.00538H8.24184C7.90952 3.98067 7.57641 4.04133 7.27414 4.18159C6.97186 4.32185 6.71046 4.53705 6.51478 4.80677C6.51478 4.80677 7.75386 4.60643 7.75386 6.27598C7.75386 6.68998 7.77518 7.88096 7.79461 8.87984C7.79827 9.02712 7.75668 9.17184 7.67545 9.29464C7.59422 9.41752 7.47726 9.5124 7.34036 9.56664C7.20346 9.62088 7.05322 9.63184 6.90992 9.59792C6.76662 9.56408 6.63716 9.48704 6.53902 9.37728C5.54022 7.98813 4.71288 6.48342 4.07498 4.89583C4.0202 4.77707 3.9325 4.67652 3.82229 4.6061C3.71207 4.53568 3.58398 4.49835 3.45319 4.49854C2.74935 4.49854 1.3409 4.49854 0.504462 4.49854C0.423354 4.49799 0.343322 4.51713 0.271246 4.55434C0.199169 4.59154 0.137201 4.64569 0.0906656 4.71212C0.0441302 4.77855 0.0144189 4.85529 0.004084 4.93574C-0.00625087 5.01619 0.00309974 5.09795 0.0313325 5.17399C0.926712 7.63 4.7837 15.3482 9.18608 15.3482H11.039C11.2332 15.3481 11.4194 15.271 11.5566 15.1337C11.6939 14.9964 11.771 14.8102 11.771 14.6161V13.4972C11.771 13.3569 11.8122 13.2195 11.8892 13.1022C11.9662 12.985 12.076 12.8927 12.2048 12.837C12.3336 12.7813 12.4759 12.7645 12.6142 12.7886C12.7525 12.8128 12.8806 12.8769 12.983 12.973L15.2008 15.0568C15.4 15.2439 15.663 15.3481 15.9363 15.3482H18.8487C20.2534 15.3482 20.2534 14.3734 19.4876 13.6191C18.9486 13.0883 17.0037 11.0383 17.0037 11.0383C16.8371 10.8658 16.7378 10.6394 16.7236 10.3999C16.7094 10.1606 16.7814 9.924 16.9264 9.73296C17.555 8.90568 18.5833 7.55146 19.0194 6.97133C19.6154 6.17838 20.6942 4.49854 19.2152 4.49854Z"
                                    fill="white" />
                            </g>
                        </svg>
                    </a>
                    <a href="https://t.me/ntl_38">
                        <svg width="25" height="25" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
                            <path
                                d="M19.9419 3.85158L16.9241 16.3047C16.6964 17.1836 16.1027 17.4024 15.2589 16.9883L10.6608 14.0234L8.44195 15.8906C8.19643 16.1055 7.99107 16.2852 7.51786 16.2852L7.84822 12.1875L16.3705 5.44924C16.7411 5.16018 16.2902 5.00002 15.7947 5.28909L5.25893 11.0938L0.723217 9.8516C-0.26339 9.58208 -0.281246 8.98832 0.928575 8.57424L18.6696 2.59378C19.4911 2.32424 20.2098 2.75393 19.9419 3.85158Z"
                                fill="white" />
                        </svg>
                    </a>
                </div>
            </div>
        </div>
        <div class="footer-copy">
            © Муниципальное автономное общеобразовательное учреждение "Лицей № 38"
        </div>
    </footer>
    <script src="{% static 'js/global/base.js' %}"></script>
    {% else %}
    <a href="{% url 'home' %}" class="logo"><img src="{% static 'img/global/long_logo.svg' %}" alt="Логотип лицея"></a>
    <div class="div-error">
        <p class="hi">Йоу, мэн, ты кто?</p>
        <img src="{% static 'img/global/not_authorized.jpg' %}" alt="Балакин...">
        <p class="advice-p">Иди авторизуйся, пока не засмеяли</p>
        <a href="{% url 'login' %}">Войти</a>
    </div>
    {% endif %}

</body>

</html>
